package com.itheima.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;
import org.springframework.web.service.annotation.PutExchange;
@Slf4j
//@Component
//@Aspect
public class MyAspest1 {

    // 切入点表达式
    @Pointcut("execution(* com.itheima.service.*.*(..))")
    public void  pt(){}

    @Before("pt()")
    public void before(JoinPoint jp){
        log.info("before...");
    }

    @Around("pt()")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        log.info("环绕通知前 around before...");

        Object result= pjp.proceed();
        log.info("环绕通知后 around after...");
        return result;
    }
    @After("pt()")
    public void after(JoinPoint jp){
        log.info("after....");
    }

}
